package com.spring.demo;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class MyApplication {
    public static  void main(String[] args){
        testAnnotation();
    }

    public static void testXml(){
        ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
        Person person = ac.getBean("person", Person.class);
        System.out.println(person.getName());
    }

    public static void testAnnotation(){
        ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
        Annotation annotation = ac.getBean("annotation", Annotation.class);
        annotation.print();
    }
}
